package com.yl.chainStore.pojo.vo.sick

import com.yl.chainStore.common.enums.Status
import com.yl.chainStore.common.enums.TypeEnum
import com.yl.chainStore.util.setDayLastTime
import com.yl.common.pojo.vo.PageSelectVo
import java.util.*

/**
 * 预约查询
 */
data class CustomerSubscribeLogSelectVo(
	//某天 (以下2个都是)
	var day: Date? = null,
	var beginTime: String? = null,

	//某天之前，包含某天   不参与sql 特殊地方用
	var beforeDay: Date? = null,



	/**
	 * 为1单个日期，为2时为开始时间和结束时间,只用来接收判断
	 */
	var type: String? = null,

	// 取消预约日期 cancel_time 日期 =
	var cancelDay:Date ?= null,

	//接收参数，要自行处理，不参与mapper条件
	var endTime: String? = null,

	// 患者  病历号，姓名，手机
	var customerQueryValue:String?= null,

	//客户id
	var customerId: Long? = null,

	//客户名称
	var customerName:String ?= null,

	//被预约医生id
	var doctorId: Long? = null,

	// 被预约的护士id
	var nurseId: Long? = null,

	//被预约的咨询师id
	var consultantId:Long? = null,

	//分院id
	var subCompanyId: Long? = null,

	//排序类型
	var orderBy: Int = 0,
	//状态 status = status
	var status: Status?=null,

	// sql plan_time < beforePlanTime
	var beforePlanTime:Date ?= null,

	// sql plan_time < beforePlanTime
	var afterPlanTime:Date ?= null,

	//用户id 不参与sql
	var userId:Long?= null,

	var subLogType:TypeEnum ?= null,

	var unStatus :Status ?= null

	):PageSelectVo(){
	//状态查询 不进入查询sql  待处理，已处理，过期，取消
	var selectStatus:Status?=null
		set(value) {
			when(value){
				Status.ALL->{}
				Status.WAIT_AUDIT->{status = Status.NEW_ADD }
				Status.COMPLETE->{status = Status.COMPLETE }
				Status.CANCEL->{status = Status.CANCEL }
				Status.OUT_TIME->{
					status = Status.WAIT_AUDIT
					//当天最后一秒
					var day = Date()
					setDayLastTime(day)
					beforePlanTime = day
				}
        else -> {}
      }
			field = value
		}

	//预约时间某天之前的 （不参与sql）
	var beforePlanDate:Date ?= null
	set(value){
		if(value != null){
			setDayLastTime(value)
			beforePlanTime = value
		}
		field = value
	}

}
